<template>
  <el-row>
    <el-button :type="active ? 'primary' : 'info'" size="small" @click="active = true">普通通道</el-button>
    <!-- <el-button :type="!active ? 'primary' : 'info'" size="small" @click="active = false">活动通道</el-button> -->
    <fu-ordinary v-if="active" :fu="fu"></fu-ordinary>
    <!-- <fu-activities v-else :activity_fu="activity_fu"></fu-activities> -->
  </el-row>
</template>

<script>
import { verfiryChannelFuQuery } from '@/api/shop'
import FuOrdinary from './components/fu-channel/ordinary'
import FuActivities from './components/fu-channel/activities'

export default {
  components: {
    FuActivities,
    FuOrdinary
  },
  data() {
    return {
      active: true,
      fu: {
        area: '',
        address: '',
        balance_type: '',
        wx_rate: '',
        wx_category: '',
        ali_rate: '',
        ali_category: '',
        enter_status: null,
        error_info: '',
        need_channel: []
      },
      activity_fu: {
        area: '',
        address: '',
        login_email: '',
        login_phone: '',
        balance_type: '',
        wx_rate: '',
        wx_category: '',
        ali_rate: '',
        ali_category: '',
        enter_status: null,
        error_info: '',
        need_channel: [],
        is_bule: '',
        is_green: '',
        ch_fumin_canyin_appoint: '',
        ch_fumin_face: '',
        ch_fumin_activity: '',
        ch_fumin_canyin_plat: ''
      }
    }
  },
  methods: {
    handleDocumentInit() {
      verfiryChannelFuQuery(this.$route.query.merchant_num).then(res => {
        if (res.data.errorCode === 0) {
          this.fu.area = res.data.result.area.name.toString()
          this.fu.address = res.data.result.address
          this.fu.balance_type = res.data.result.balance_type
          this.fu.wx_rate = res.data.result.wx_rate
          this.fu.wx_category = res.data.result.wx_category.name
          this.fu.ali_rate = res.data.result.ali_rate
          this.fu.ali_category = res.data.result.ali_category.name
          this.fu.error_info = res.data.result.enter_status.error_info
          this.fu.need_channel = res.data.result.need_channel
          this.fu.enter_status = res.data.result.enter_status.name
        } else {
          this.$message.error(res.data.errorMsg)
        }
      })
      // merchantChannelFuActivityQuery(this.$route.query.merchant_num).then(res => {
      //   if (res.data.errorCode === 0) {
      //     res.data.result.is_green === 0 ? this.activity_fu.is_green = false : this.activity_fu.is_green = true
      //     res.data.result.is_blue === 0 ? this.activity_fu.is_blue = false : this.activity_fu.is_blue = true
      //     this.activity_fu.area = res.data.result.area.name.toString()
      //     this.activity_fu.address = res.data.result.address
      //     this.activity_fu.login_phone = res.data.result.login_phone
      //     this.activity_fu.login_email = res.data.result.login_email
      //     this.activity_fu.balance_type = res.data.result.balance_type
      //     this.activity_fu.need_channel = res.data.result.need_channel
      //     this.activity_fu.wx_rate = Number(res.data.result.wx_rate)
      //     this.activity_fu.ali_rate = Number(res.data.result.ali_rate)
      //     this.activity_fu.wx_category = res.data.result.wx_category.name
      //     this.activity_fu.ali_category = res.data.result.ali_category.name
      //     this.activity_fu.enter_status = res.data.result.enter_status.name
      //     this.activity_fu.error_info = res.data.result.enter_status.error_info
      //     this.activity_fu.ch_fumin_face = res.data.result.photos.ch_fumin_face
      //     this.activity_fu.ch_fumin_activity = res.data.result.photos.ch_fumin_activity
      //     this.activity_fu.ch_fumin_canyin_plat = res.data.result.photos.ch_fumin_canyin_plat
      //     this.activity_fu.ch_fumin_canyin_appoint = res.data.result.photos.ch_fumin_canyin_appoint
      //   } else {
      //     this.$message.error(res.data.errorMsg)
      //   }
      // })
    }
  },
  created() {
    this.handleDocumentInit()
  }
}
</script>
